package com.hdax.easybuy.controller;


import com.hdax.easybuy.api.ProductServiceClient;
import com.hdax.easybuy.api.UserServiceClient;
import com.hdax.easybuy.entity.Product;
import com.hdax.easybuy.entity.ProductCategory;
import com.hdax.easybuy.entity.Users;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
//@RequestMapping("/managerProduct")
public class ProductManagerController {
    @Autowired
    private ProductServiceClient productServiceClient;
    //查看所有的商品
    @RequestMapping("/managerProduct/queryAllProduct")
    @ResponseBody
    public List<Product> queryAll(){
        return productServiceClient.queryAll();
    }
    //根据id查看单个商品
    @RequestMapping("/managerProduct/queryById/{id}")
    @ResponseBody
    public Product queryById(@PathVariable("id") int id){
        return productServiceClient.queryById(id);
    }
    //一级菜单下面所有的商品
    @RequestMapping("/managerProduct/queryProductById/{id}")
    public List<Product> queryProductById(@PathVariable("id") int id){
        return productServiceClient.queryProductById(id);
    }




}
